Original source for NBA Scores (2008) Flexdashboard:
https://beta.rstudioconnect.com/jjallaire/htmlwidgets-d3heatmap/htmlwidgets-d3heatmap.html
| G | MIN | PTS | |
|---|---|---|---|
| Dwyane Wade | 79 | 38.6 | 30.2 |
| LeBron James | 81 | 37.7 | 28.4 |
| Kobe Bryant | 82 | 36.2 | 26.8 |
| Dirk Nowitzki | 81 | 37.7 | 25.9 |
| Danny Granger | 67 | 36.2 | 25.8 |
| Kevin Durant | 74 | 39.0 | 25.3 |
| Kevin Martin | 51 | 38.2 | 24.6 |
| Al Jefferson | 50 | 36.6 | 23.1 |
| Chris Paul | 78 | 38.5 | 22.8 |
| Carmelo Anthony | 66 | 34.5 | 22.8 |
| Chris Bosh | 77 | 38.1 | 22.7 |
| Brandon Roy | 78 | 37.2 | 22.6 |
| Antawn Jamison | 81 | 38.2 | 22.2 |
| Tony Parker | 72 | 34.1 | 22.0 |
| Amare Stoudemire | 53 | 36.8 | 21.4 |
| Joe Johnson | 79 | 39.5 | 21.4 |
| Devin Harris | 69 | 36.1 | 21.3 |
| Michael Redd | 33 | 36.4 | 21.2 |
| David West | 76 | 39.3 | 21.0 |
| Zachary Randolph | 50 | 35.1 | 20.8 |
---
title: "Example Flexdashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
theme: paper
source_code: embed
runtime: shiny
---
Test HTML Widget
=====================================
Original source for NBA Scores (2008) Flexdashboard:
https://beta.rstudioconnect.com/jjallaire/htmlwidgets-d3heatmap/htmlwidgets-d3heatmap.html
```{r setup, include=FALSE}
library("knitr")
library("d3heatmap")
library("flexdashboard")
url <- "http://datasets.flowingdata.com/ppg2008.csv"
nba_players <- read.csv(url, row.names = 1)
```
### Stats by Player {data-width=650}
```{r}
d3heatmap(nba_players, scale = "column")
```
### Top Scorers {data-width=350}
```{r}
knitr::kable(nba_players[1:20,c("G", "MIN", "PTS")])
```
Test Plotly and Shiny Elements
=====================================
Inputs 1{.sidebar}
-------------------------------------
Please press start button:
```{r, echo=FALSE}
library("plotly")
library("shiny")
# sidebar shiny start button
actionButton("start_button", label="Start")
```
Row {data-height=1600}
-----------------------------------------------------------------------
```{r}
# define reactive shiny function on button click
visualization_function <- eventReactive(input$start_button, {
# with progress bar
withProgress(message = 'Make Visualization', value = 0, {
# increment progress bar
incProgress(0.3)
# stop eval to see progress bar long enough :)
Sys.sleep(0.5)
# make data from diamonds data sample
d <- diamonds[sample(nrow(diamonds), 1000), ]
# make interaactive plot
p <- plot_ly( d,
x = ~carat, y = ~price,
# Hover text:
text = ~paste("Price: ", price, '$
Cut:', cut),
color = ~carat,
size = ~carat
)
})
})
# render plot for dynamically resizing to browser window
renderPlotly({visualization_function()
})
```